package com.lanou3g.demo.db;

import com.mchange.v2.c3p0.ComboPooledDataSource;

import java.sql.Connection;
import java.sql.SQLException;

public class DBConnector {

    private static DBConnector instance = new DBConnector();
    private ComboPooledDataSource dataSource;

    private DBConnector(){
        dataSource = new ComboPooledDataSource();
    }

    public  Connection getConnection() throws SQLException {
        return dataSource.getConnection();
    }

    public static DBConnector getInstance(){
        return instance;
    }

    public void release(){
        dataSource.close();
    }
}
